package com.clz.appdesign.myapp;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import java.util.ArrayList;
import java.util.List;

import cn.jianke.imageswitcher.widget.PictureShowDialog;

public class ImageActivity extends AppCompatActivity {
    // 图片浏览器对话框
    private PictureShowDialog mPictureShowDialog;
    // 图片url列表
    private List<String> imageUrlList;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_image);
        // 初始化图片url列表
        imageUrlList = new ArrayList<>();
        // 模拟数据
        imageUrlList.add("http://g.hiphotos.baidu.com/imgad/pic/item/f603918fa0ec08fa9f0b7dd85eee3d6d55fbda42.jpg");
        imageUrlList.add("http://g.hiphotos.baidu.com/imgad/pic/item/4a36acaf2edda3cc6a22d65f06e93901203f928e.jpg");
        imageUrlList.add("http://g.hiphotos.baidu.com/imgad/pic/item/023b5bb5c9ea15cec0e68e76b1003af33a87b241.jpg");
        imageUrlList.add("http://f.hiphotos.baidu.com/imgad/pic/item/5366d0160924ab18ead18f4832fae6cd7a890b8d.jpg");
        // 初始化Dialog
        mPictureShowDialog = new PictureShowDialog(this);
        // 添加数据源
        mPictureShowDialog.loadRemoteImage(imageUrlList, this);

        // 设定自动轮播
        mPictureShowDialog.startAutoRotation(PictureShowDialog.AUTO_ROTATION_TIME);
        // 显示对话框
        mPictureShowDialog.show();
    }
}
